ASoC: get sdw dmic number for Intel platforms#5843
Draft
bardliao wants to merge 3 commits into
Draft
Conversation
bardliao
requested review from
dbaluta,
kv2019i,
lgirdwood,
plbossart and
ranj063
as code owners
July 14, 2026 14:25
There was a problem hiding this comment.
Pull request overview
This PR adds support for deriving the SoundWire DMIC channel/transducer count from SDCA firmware-described entities and appending that count to Intel SOF SoundWire DAI link names, enabling more precise topology selection based on connected microphone transducers.
Changes:
- Add
sdca_get_mic_count()to parse SDCA Function entity metadata and return a microphone transducer count. - Update Intel SOF SoundWire machine driver to query SDCA SmartMic functions and suffix the DAI link name with
-<N>ch. - Expose the new helper via
include/sound/sdca.hand import the SDCA symbol namespace in the machine driver.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sound/soc/sdca/sdca_functions.c | Adds sdca_get_mic_count() to parse SDCA entity properties and extract microphone transducer count. |
| sound/soc/intel/boards/sof_sdw.c | Appends SDCA-derived mic channel count to SoundWire capture link name for topology matching; adds SDCA namespace import. |
| include/sound/sdca.h | Exposes sdca_get_mic_count() in the public SDCA header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+218
to
+239
| num_entities = fwnode_property_count_u32(function_node, | ||
| "mipi-sdca-entity-id-list"); | ||
| if (num_entities <= 0) { | ||
| dev_err(&slave->dev, | ||
| "%pfwP: no entity list found for function type %u\n", | ||
| function_node, function->type); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| entity_list = kcalloc(num_entities, sizeof(*entity_list), GFP_KERNEL); | ||
| if (!entity_list) | ||
| return -ENOMEM; | ||
|
|
||
| ret = fwnode_property_read_u32_array(function_node, | ||
| "mipi-sdca-entity-id-list", | ||
| entity_list, num_entities); | ||
| if (ret) { | ||
| dev_err(&slave->dev, | ||
| "%pfwP: failed to read entity id list for function type %u: %d\n", | ||
| function_node, function->type, ret); | ||
| return -EINVAL; | ||
| } |
We can get how many mic transducers are connected to the codec. The information will be used for selecting the topology with proper dmic channel number. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The commit get the sdca sdw dmic number form the mipi-sdca-cluster-channel-id property. The dai link name will be used to select the function topology with a proper dmic channel number. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
dmic support Now the machine driver provides the sdca dmic channel number information in the dai link name. We can use the information to select different topologies for different dmic channels. To be backward compatible, the 2ch sdca dmic topology will still use the "sdca-mic" topology. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
sound/soc/sdca/sdca_functions.c:225
- When the entity-id-list property is missing, fwnode_property_count_u32() returns a negative errno (typically -EINVAL), and the current log prints it as an "entity number" (e.g. -22), which is misleading. This can be made consistent with existing sdca parsing code (find_sdca_entities()) by distinguishing missing list vs exceeding SDCA_MAX_ENTITY_COUNT.
num_entities = fwnode_property_count_u32(function_node,
"mipi-sdca-entity-id-list");
if (num_entities <= 0 || num_entities > SDCA_MAX_ENTITY_COUNT) {
dev_err(&slave->dev,
"%pfwP: entity number %d is invalid for function type %u\n",
function_node, num_entities, function->type);
return -EINVAL;
}
Comment on lines
+1075
to
+1084
| if (sdw_mic_num <= 0 || strstr(name, "ch")) | ||
| continue; | ||
|
|
||
| name = devm_kasprintf(dev, GFP_KERNEL, "%s-%dch", | ||
| name, sdw_mic_num); | ||
| if (!name) | ||
| return -ENOMEM; | ||
|
|
||
| devm_kfree(dev, tmp); | ||
| break; |
Collaborator
Author
|
This depends on thesofproject/sof#11013. |
bardliao
marked this pull request as draft
July 20, 2026 03:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The topology needs to set the DMIC channel number according to the number of transducers connected to the codec. This information can be provided via the DAI link name for proper topology selection.